//
//  WordsCardView.h
//  JPWords
//
//  Created by 梁淑婷 on 2024/6/22.
//

#import "JPCustomView.h"
#import "WordListModel.h"

NS_ASSUME_NONNULL_BEGIN

@class WordsCardView;

@protocol WordsCardViewDelegate <NSObject>

@optional

- (void)applyErrorTap:(WordsCardView*)wordsCardView;
- (void)collectTap:(WordsCardView*)wordsCardView andIsCollect:(BOOL)isCollect;
- (void)beginTestTap:(WordsCardView*)wordsCardView;
- (void)nextTap:(WordsCardView*)wordsCardView andIsKnow:(BOOL)isKnow;
- (void)speakText:(WordsCardView*)wordsCardView andText:(NSString*)text;
- (void)stopSpeak:(WordsCardView*)wordsCardView;
- (void)playAudio:(WordsCardView*)wordsCardView andAudio:(NSString*)audio;

@end

@interface WordsCardView : JPCustomView

@property(nonatomic,assign)NSInteger type;//1 第一个 2 第二个 3 第三个和第三个后面的
@property (nonatomic,weak)id<WordsCardViewDelegate>delegate;
@property(nonatomic,strong)WordListModel *model;
@property(nonatomic,assign)BOOL isLast;//是否是最后一张列表卡片
@property(nonatomic,copy)NSArray *wordArr;
@property(nonatomic,assign)BOOL isTest;
@property(nonatomic,assign)CGFloat currentAvailableWidth;
@property(nonatomic,assign)CGFloat currentAvailableHeight;
@property(nonatomic,strong)UIButton *knownBtn;
@property(nonatomic,strong)UIView *knowBgView;



-(void)stopPlayAnimation;
-(void)speakJapaneseText:(NSString *)text;
-(void)playAudio:(NSString*)audio;
-(instancetype)initWithFrame:(CGRect)frame andCurrentAvailableWidth:(CGFloat)currentAvailableWidth andCurrentAvailableHeight:(CGFloat)currentAvailableHeight;
-(void)correctBtnClick;
-(void)errorBtnClick;

@end

NS_ASSUME_NONNULL_END
